<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            position:absolute;
            left: 50px;
            top: 50px;
            border-radius: 50%;
        }
        .one{
            width: 400px;height: 400px;background: #aef;
        }
        .two{
            width: 300px;height: 300px;background: #ecf
        }
        .three{
            width: 200px;height: 200px;background: rgb(173, 136, 192)
        }
    </style>
</head>
<body>
    <div class="one">
        <div class="two">
            <div class="three"></div>
        </div>
    </div>

    <script>
        //点谁谁变黑.  获取所有的 div
        let divs = document.querySelectorAll('div');

        //遍历
        divs.forEach(item => {
            item.onclick = function(e){
                //改变背景颜色
                this.style.background = 'black';
                //阻止冒泡
                e.stopPropagation();
            }
        })

    </script>
</body>
</html>